<?php

namespace App\Http\Requests\CRM;

use App\Enums\GoodsSpecificationStatus;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\Enum;

class GoodsRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'category_id' => 'required|integer',
            'name' => 'required',
            'price' => 'required|numeric',
            'original_price' => 'required|numeric',
            'unit' => 'required',
            'purchase_cost_price' => 'required|numeric',
            'sale_cost_price' => 'required|numeric',
            'specification_status' => new Enum(GoodsSpecificationStatus::class),
//            'specifications' => 'required|array',
            'head_image' => 'required',
            'images' => 'required|array',
            'point' => 'required|integer|min:0',
        ];
    }
}
